// src/router/index.js

import { createRouter, createWebHistory } from 'vue-router'
import MainLayout from '@/layouts/MainLayout.vue'

// 异步加载页面组件
const Login = () => import('@/views/login/LoginView.vue')
const Dept = () => import('@/views/dept/Dept.vue')
const Employee = () => import('@/views/employee/Employee.vue')
const Knowsledge = () => import('@/views/knowsledge/Knowsledge.vue')
const AiChat = () => import('@/views/ai/AiChat.vue')
const WordCloud = () => import('@/views/analytics/WordCloud.vue')
const DataCount = () => import('@/views/analytics/DataCount.vue')
const TermFreq = () => import('@/views/term/TermFreq.vue')
const DeptScore = () => import('@/views/analytics/DeptScore.vue')
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/main',
    name: 'MainLayout',
    component: MainLayout,
    redirect: '/main/dept',
    children: [
      { path: 'dept', component: Dept, meta: { title: '部门管理' } },
      { path: 'employee', component: Employee, meta: { title: '员工管理' } },
      { path: 'knowsledge', component: Knowsledge, meta: { title: '知识库管理' } },
      { path: 'ai_chat', component: AiChat, meta: { title: '智能客服' } },
      { path: 'word_cloud', component: WordCloud, meta: { title: '热词统计' } },
      { path: 'data_count', component: DataCount, meta: { title: '数据分析' } },
      { path: 'term_freq', component: TermFreq, meta: { title: '热词管理' } }, {
        path: '/main/dept_score', component: DeptScore, meta: { title: '部门评分' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router